package com.sghd.candy.module.charge.manager;

import com.sghd.candy.module.player.manager.Player;
import com.sghd.common.ramcache.anno.Inject;
import com.sghd.common.ramcache.service.EntityCacheService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * @author Allen
 * @date 2019/02/27
 */
@Component
public class ChargeManager {
    private Logger logger = LoggerFactory.getLogger(getClass());
    @Inject
    private EntityCacheService<Long, Charge> chargeEntityCacheService;

    public Charge load(long playerId) {
        return chargeEntityCacheService.loadOrCreate(playerId, builder -> Charge.valueOf(playerId));
    }
}
